import * as fetch from 'common/fetch.js';

/**
 * 预下单
 */
export function orderPreview({memberId, addressId, cartIds}) {
  return fetch.post('/order/orderPreview', {memberId, addressId, cartIds});
}

/**
 * 下单
 */
export function createOrder({memberId, cartIds, addressId}) {
  return fetch.post('/order/createOrder', {memberId, cartIds, addressId});
}

/**
 * 获取用户订单列表
 */
export function userOrderList({memberId, orderStatus, pageNo, pageSize }) {
  return fetch.get('/order/orderList?memberId='+memberId+'&orderStatus='+orderStatus+'&pageNo='+pageNo+"&pageSize="+pageSize);
}

/**
 * 获取订单详情
 */
export function orderDetail({orderId}) {
  return fetch.get('/order/orderInfo/'+orderId);
}

/**
 * 确认收货
 */
export function orderReceive({orderId}) {
  return fetch.post('/order/orderReceive', {orderId});
}